package org.yjhking.clientFallback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.yjhking.domain.User;
import org.yjhking.feignclient.UserFeignClient;

// 将托底类交给spring管理，否则Hstrix无法进行调用
@Component
public class UserFeignClientFallback implements UserFeignClient {
    
    //日志打印器
    private Logger log = LoggerFactory.getLogger(UserFeignClientFallback.class);
    
    @Override
    public User getById(Long id) {
        log.info("用户服务不可用");
        //托底数据
        return new User(-1l, "无此用户", "用户服务不可用");
    }
}